<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>hello vue</title>
    <script src="https://unpkg.com/vue@latest"></script>
</head>
<body>
    <div id="root"></div>
</body>
<script>
    Vue.createApp({
        data() {
            return {
                show: true,
                content: 'hello vue'
            }
        },
        methods: {
            handleClick() {
                this.content = this.content.split('').reverse().join('')
            },
            handleClick2() {
                this.show = !this.show
            }
        },
        template: `
            <div>
                <span v-if="show">{{content}}</span>
                <button v-on:click="handleClick2">隐藏</button>
                <button v-on:click="handleClick">反转</button>
            </div>
        `
    }).mount('#root');
</script>
</html>